from PyQt5 import QtWidgets
from PyQt5 import QtCore
from PyQt5 import QtGui

import sys

class QComboBoxTest(QtWidgets.QWidget):
    def __init__(self, parent=None):
        super(QComboBoxTest, self).__init__(parent)

        self.setWindowTitle("QComboBoxTest")

        self.resize(300, 90)

        self.combo_box = QtWidgets.QComboBox()
        self.combo_box.addItem("C")
        self.combo_box.addItem("C++")
        self.combo_box.addItem("Python")
        self.combo_box.addItems(["Java", "C#"])
        self.combo_box.currentIndexChanged.connect(self.combo_box_index_change)

        self.label_show_selected = QtWidgets.QLabel(" ")

        _v_box_layout = QtWidgets.QVBoxLayout()
        _v_box_layout.addWidget(self.combo_box)
        _v_box_layout.addWidget(self.label_show_selected)

        self.setLayout(_v_box_layout)


    def combo_box_index_change(self, index):
        self.label_show_selected.setText(self.combo_box.currentText())
        print("current selected index: ", index)
        print("Item in list")
        for i in range(self.combo_box.count()):
            print(self.combo_box.itemText(i))



if __name__ == '__main__':
    app = QtWidgets.QApplication(sys.argv)
    QtWidgets.QApplication.setStyle("Fusion")
    win = QComboBoxTest()
    win.show()
    sys.exit(app.exec_())